﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Fast.Framework.Models;

namespace Fast.Framework
{
    public static class SqlFunc
    {
        #region 聚合函数
        /// <summary>
        /// 取最大值
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source">源</param>
        public static T Max<T>(T source)
        {
            return source;
        }

        /// <summary>
        /// 取最小值
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source">源</param>
        public static T Min<T>(T source)
        {
            return source;
        }

        /// <summary>
        /// 合计
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source">源</param>
        public static T Sum<T>(T source)
        {
            return source;
        }

        /// <summary>
        /// 平均
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source">源</param>
        /// <returns></returns>
        public static T Avg<T>(T source)
        {
            return source;
        }

        /// <summary>
        /// 计数
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source">源</param>
        /// <returns></returns>
        public static int Count<T>(T source)
        {
            return 0;
        }
        #endregion

        #region 日期和时间函数

        /// <summary>
        /// 年
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source"></param>
        /// <returns></returns>
        public static int Year<T>(T source)
        {
            return DateTime.Now.Year;
        }

        /// <summary>
        /// 月
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source"></param>
        /// <returns></returns>
        public static int Month<T>(T source)
        {
            return DateTime.Now.Month;
        }

        /// <summary>
        /// 天数
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source"></param>
        /// <returns></returns>
        public static int Day<T>(T source)
        {
            return DateTime.Now.Day;
        }

        #region SqlServer
        /// <summary>
        /// 获取日期时间
        /// </summary>
        public static void GetDate()
        {
        }
        #endregion

        #region MySql
        /// <summary>
        /// 当前日期和时间
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source"></param>
        /// <returns></returns>
        public static void Current_Timestamp()
        {
        }

        /// <summary>
        /// 当前日期
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source"></param>
        /// <returns></returns>
        public static void Current_Date()
        {
        }

        /// <summary>
        /// 当前时间
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source"></param>
        /// <returns></returns>
        public static void Current_Time()
        {
        }
        #endregion

        #endregion

        #region 数学函数

        /// <summary>
        /// 绝对值
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source">源</param>
        /// <returns></returns>
        public static T Abs<T>(T source)
        {
            return source;
        }

        /// <summary>
        /// 四舍五入
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source">源</param>
        /// <param name="lenght">长度</param>
        /// <returns></returns>
        public static T Round<T>(T source, int lenght)
        {
            return source;
        }


        #endregion

        #region 字符串函数
        /// <summary>
        /// 长度
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source">源</param>
        /// <returns></returns>
        public static int Len<T>(T source)
        {
            return source.ToString().Length;
        }
        #endregion

        #region 其它函数
        /// <summary>
        /// 是空
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source">源</param>
        /// <param name="defaultValue">默认值</param>
        /// <returns></returns>
        public static T IsNull<T>(T source, T defaultValue)
        {
            return source;
        }

        /// <summary>
        /// 调用
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source">源</param>
        /// <returns></returns>
        public static T Call<T>(T source)
        {
            return source;
        }
        #endregion
    }
}
